package utils

import (
	"crypto/rand"
	"github.com/oklog/ulid"
	"strconv"
	"time"
)

const (
	Tst0     = "deleted"
	Tst1     = "finished"
	Tst2     = "incomplete"
	DataFile = "./assets/tasks.htd"
	TaskLine = "%s, %s, %s, %s, %s"
)

// Other functions

func CreateUlid() string {
	entropy := ulid.Monotonic(rand.Reader, 0)
	id := ulid.MustNew(ulid.Now(), entropy)
	return id.String()
}

func JudgeGreeting() string {
	hour, err := strconv.Atoi(time.Now().Format("15"))
	Must(err)
	switch {
	case hour <= 7:
		return "早上好"
	case hour <= 11:
		return "上午好"
	case hour == 12:
		return "中午好"
	case hour <= 17:
		return "下午好"
	case hour == 18:
		return "傍晚好"
	default:
		return "晚上好"
	}
}
